package be.fomp.jeve.application.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateParser {
	
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	//private static final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	
	/**
	 * This method parses a String into a date. <br />
	 * When date parsing has failed it will return null.
	 * 
	 * @return The parsed date or null if invalid.
	 */
	public static Date parseDate(String date) {
		try {
			return dateFormat.parse(date);
		} catch (ParseException pe) {
			return null;
		}
	}
}
